home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / agl103p.lha / src / agl / RCS / sprite.c,v < prev    next >
Encoding:
Text File  |  1994-12-09  |  3.3 KB  |  279 lines

  1. head    1.2;
  2. branch    1.2.1.99;
  3. access;
  4. symbols;
  5. locks; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.2
  10. date    93.01.26.22.38.50;    author jason;    state Exp;
  11. branches
  12.     1.2.1.1;
  13. next    ;
  14.  
  15. 1.2.1.1
  16. date    94.03.29.05.41.32;    author jason;    state Exp;
  17. branches;
  18. next    1.2.1.2;
  19.  
  20. 1.2.1.2
  21. date    94.11.16.06.29.47;    author jason;    state Exp;
  22. branches;
  23. next    1.2.1.3;
  24.  
  25. 1.2.1.3
  26. date    94.12.09.05.29.56;    author jason;    state Exp;
  27. branches;
  28. next    ;
  29.  
  30.  
  31. desc
  32. @second mouse icon
  33. @
  34.  
  35.  
  36. 1.2
  37. log
  38. @Initial RCS Version
  39. @
  40. text
  41. @#include"agl.h"
  42.  
  43. #define SPRITESPACE    4
  44. #define SPRITELINES    7
  45.  
  46. struct SimpleSprite MouseSprite;
  47.  
  48. UBYTE *SpriteChip;
  49.  
  50. UBYTE SpriteData[SPRITESPACE*SPRITELINES]=
  51.     {
  52.     0,0, 0,0,    /* position,control */
  53.  
  54.     0x20,0x00,0x00,0x00,
  55.     0x20,0x00,0x00,0x00,
  56.     0xF8,0x00,0x00,0x00,
  57.     0x20,0x00,0x00,0x00,
  58.     0x20,0x00,0x00,0x00,
  59.  
  60.     0,0, 0,0,    /* end */
  61.     };
  62.  
  63. long SpriteID= -1;
  64.  
  65.  
  66.  
  67. /******************************************************************************
  68. void    create_mousesprite(void)
  69.  
  70. ******************************************************************************/
  71. /*PROTOTYPE*/
  72. void create_mousesprite(void)
  73.     {
  74.     SpriteChip=AllocMem(SPRITESPACE*SPRITELINES,MEMF_CHIP);
  75.     memcpy(SpriteChip,SpriteData,SPRITESPACE*SPRITELINES);
  76.  
  77.     SpriteID=GetSprite(&MouseSprite,3);
  78.     if(SpriteID!=3)
  79.         {
  80.         GL_error("Error creating mouse sprite");
  81.         SpriteID= -1;
  82.         return;
  83.         }
  84.  
  85.     MouseSprite.height=SPRITELINES-2;
  86.  
  87.     SetRGB4(GLView,21,15,0,0);
  88.     SetRGB4(GLView,22,0,15,0);
  89.     SetRGB4(GLView,23,0,0,15);
  90.  
  91.     ChangeSprite(GLView,&MouseSprite,SpriteChip);
  92.     printf("Sprite Created\n");
  93.  
  94.     move_mousesprite(0,0);
  95.     }
  96.  
  97.  
  98. /******************************************************************************
  99. void    move_mousesprite(long mx,long my)
  100.  
  101. ******************************************************************************/
  102. /*PROTOTYPE*/
  103. void move_mousesprite(long mx,long my)
  104.     {
  105.     static long lastx= -1,lasty= -1;
  106.  
  107.     if(mx!=lastx || my!=lasty)
  108.         {
  109.         WaitBOVP(GLView);
  110.         MoveSprite(GLView,&MouseSprite,mx-6,SCREENY-my-5);
  111. /*         printf("Sprite Moved %d %d\n",mx,my); */
  112.  
  113.         lastx=mx;
  114.         lasty=my;
  115.         }
  116.     }
  117.  
  118.  
  119. /******************************************************************************
  120. void    free_mousesprite(void)
  121.  
  122. ******************************************************************************/
  123. /*PROTOTYPE*/
  124. void free_mousesprite(void)
  125.     {
  126.     FreeSprite(SpriteID);
  127.     FreeMem(SpriteChip,SPRITESPACE*SPRITELINES);
  128.     printf("Sprite Freed\n");
  129.     }
  130. @
  131.  
  132.  
  133. 1.2.1.1
  134. log
  135. @Added RCS Header
  136. @
  137. text
  138. @a0 16
  139.  
  140. /******************************************************************************
  141.  
  142. $Id: sprite.c,v 1.2.1.1 2002/03/26 22:04:22 jason Exp jason $
  143.  
  144. $Log: sprite.c,v $
  145.  * Revision 1.2.1.1  2002/03/26  22:04:22  jason
  146.  * Added RCS Header
  147.  *
  148.  * Revision 1.2.1.1  2002/03/26  22:00:51  jason
  149.  * RCS/agl.h,v
  150.  *
  151.  
  152. ******************************************************************************/
  153.  
  154.  
  155. d70 1
  156. a70 1
  157.         MoveSprite(GLView,&MouseSprite,mx-6,GLScreen->Height-my-5);
  158. @
  159.  
  160.  
  161. 1.2.1.2
  162. log
  163. @added NOT_EXTERN check
  164. @
  165. text
  166. @d4 1
  167. a4 1
  168. $Id: sprite.c,v 1.2.1.1 1994/03/29 05:41:32 jason Exp jason $
  169. a6 3
  170.  * Revision 1.2.1.1  1994/03/29  05:41:32  jason
  171.  * Added RCS Header
  172.  *
  173. a16 1
  174. #ifndef NOT_EXTERN
  175. a17 1
  176. #endif
  177. @
  178.  
  179.  
  180. 1.2.1.3
  181. log
  182. @added copyright
  183. @
  184. text
  185. @d1 1
  186. d4 1
  187. a4 4
  188. Copyright © 1994 Jason Weber
  189. All Rights Reserved
  190.  
  191. $Id: sprite.c,v 1.2.1.2 1994/11/16 06:29:47 jason Exp jason $
  192. a6 3
  193.  * Revision 1.2.1.2  1994/11/16  06:29:47  jason
  194.  * added NOT_EXTERN check
  195.  *
  196. @
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.